home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 414_02 / private / _fixcurs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-19  |  2.1 KB  |  95 lines

  1. #define    CURSES_LIBRARY    1
  2. #include <curses.h>
  3.  
  4. #ifdef PDCDEBUG
  5. char *rcsid__fixcurs = "$Header: C:\CURSES\private\RCS\_fixcurs.c 2.1 1993/06/18 20:23:18 MH Rel MH $";
  6. #endif
  7.  
  8.  
  9.  
  10.  
  11. /*man-start*********************************************************************
  12.  
  13.   PDC_fix_cursor()    - Fix the cursor start and stop scan lines (if necessary)
  14.  
  15.   PDCurses Description:
  16.      This is a private PDCurses routine.
  17.  
  18.      This routine will fix the cursor shape for certain video adapters.
  19.      Normally, the values used are correct, but some adapters choke.
  20.      The most noticable choke is on a monochrome adapter.  The "correct"
  21.      scan lines will result in the cursor being set in the middle of the
  22.      character cell, rather than at the bottom.
  23.  
  24.      The passed flag indicates whether the cursor is visible or not.
  25.  
  26.      This only applies to the DOS platform.
  27.  
  28.   PDCurses Return Value:
  29.      This function returns OK on success and ERR on error.
  30.  
  31.   PDCurses Errors:
  32.      No errors are defined for this function.
  33.  
  34.   Portability:
  35.      PDCurses    int PDC_fix_cursor( int flag );
  36.  
  37. **man-end**********************************************************************/
  38.  
  39. int    PDC_fix_cursor(int flag)
  40. {
  41. #ifdef    DOS
  42.  
  43. #ifdef PDCDEBUG
  44.     if (trace_on) PDC_debug("PDC_fix_cursor() - called\n");
  45. #endif
  46.  
  47. #ifdef    FLEXOS
  48.     return( OK );
  49. #endif
  50.  
  51.     if (_cursvar.bogus_adapter)
  52.         return( OK );
  53.  
  54.     switch (_cursvar.adapter)
  55.     {
  56.     case _EGACOLOR:
  57.     case _EGAMONO:
  58.     case _MDS_GENIUS:        /* Some clones look like a Genius;-)  */
  59.         if (flag & 0x01)
  60.             setdosmembyte (0x487, getdosmembyte (0x487) | 0x01); /* Enable emulation */
  61.         else
  62.             setdosmembyte (0x487, getdosmembyte (0x487) & ~0x01); /* Disable emulation */
  63.         break;
  64.  
  65.     case _VGACOLOR:
  66.     case _VGAMONO:
  67.         if (flag & 0x01)
  68.             regs.x.ax = 0x1200;        /* Enable  emulation */
  69.         else
  70.             regs.x.ax = 0x1201;        /* Disable emulation */
  71.         regs.h.bl = 0x34;
  72.         int86(0x10, ®s, ®s);
  73.  
  74.         break;
  75.  
  76.     case _MCGACOLOR:
  77.     case _MCGAMONO:
  78.     case _MDA:
  79.     case _CGA:
  80.     case _NONE:
  81.     default:
  82.         break;
  83.     }
  84.     return( OK );
  85. #endif
  86.  
  87. #ifdef     OS2
  88.         return( OK );
  89. #endif
  90.  
  91. #ifdef     UNIX
  92.         return( OK );
  93. #endif
  94. }
  95.